function toggle_req(req) {
	toggleItem(getItem(req+"_msg").style,true); 
	toggleItem(getItem(req+"_rep").style,false); 		
	for(i=1;getItem(req+"_res"+i);i++) {
		toggleItem(getItem(req+"_res"+i).style,true);
		toggleItem(getItem(req+"_res"+i+"_msg").style,false);
	}
	collapseAll(req);
}	

/*toggle messages of a response. when one response 
 is clicked it closes all other messages of other responses.*/
function toggle_req_res(req,req_res) {
	var item_res_msg = false;
	var item_msg = getItem(req_res+"_msg") ;
		
	for(i=1;getItem(req+"_res"+i);i++) {
		item_res_msg = getItem(req+"_res"+i+"_msg");
		if(item_res_msg == item_msg)
			toggleItem(item_msg.style,true); 
		else
			item_res_msg.style.display = "none" ;		
	}			
}

function toggle_req_rep(req,req_rep) {
	var item_rep = getItem(req_rep);
	collapseAll(req);
	toggleItem(item_rep.style,true);
}	

function collapseAll(req) {
	var item_req = getItem(req);
	for(j=1;getItem("req"+j);j++) {
		if(getItem("req"+j)!=item_req || !item_req)	{	
			getItem("req"+j+"_msg").style.display = "none";
			getItem("req"+j+"_rep").style.display = "none";			
			for(i=1;getItem("req"+j+"_res"+i);i++) {
				getItem("req"+j+"_res"+i).style.display = "none";
				getItem("req"+j+"_res"+i+"_msg").style.display = "none";	
			}
		}
	}	
}	
function getItem(id) {
	var itm = false;
	if(document.getElementById)
		itm = document.getElementById(id);
	else if(document.all)
		itm = document.all[id];
	else if(document.layers)
		itm = document.layers[id];
	return itm;
}
function toggleItem(item,toggle) {
	if(!item)
		return false;
	if(navigator.appName.toUpperCase()=='MICROSOFT INTERNET EXPLORER')
		type = "block";
	else	
		type = "table-row";				
	if(toggle && item.display == type) 
			item.display = "none";					
	else if (toggle && item.display != type) 
			item.display = type;	
	else if (!toggle && item.display == type)
			item.display = "none";
	return false;
}